from django.conf.urls.defaults import *
from djstu.views import hello,current_datetime,hours_ahead,good,display_meta
from djstu.books import views
from django.views.generic.simple import direct_to_template
from django.views.generic import list_detail
from books.models import Publisher
from django.contrib.auth.views import login, logout
#from djstu.contact.views import contact, thanks

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()

pub_info = {
    'queryset' : Publisher.objects.all(),
    'template_name':'publisher_list.html',
    }

urlpatterns = patterns('',
                       (r'^$', hello),
                       (r'^hello/$',hello),
                       (r'^time/$', current_datetime),
                       (r'^time/plus/(\d{1,2})/$', hours_ahead),
                       (r'^good/$', good),
                       (r'^meta/$', display_meta),
                       (r'^search_form', views.search_form),
                       (r'^search/$', views.search),
                       (r'^contact/$','djstu.contact.views.contact'),
                       (r'^contact/thanks/$', 'djstu.contact.views.thanks'),
                       (r'^about/$', direct_to_template,
                        {'template':'about.html'}),
)

urlpatterns += patterns('',
                        (r'^accounts/login/$', login,{'template_name':'accounts/login.html'}),
                        (r'^accounts/logout/$', logout),
                        (r'^accounts/profile/$', 'djstu.accounts.views.profile'),
                        (r'^accounts/register/$', 'djstu.accounts.views.register'),
                        )

urlpatterns += patterns('',
                        (r'^pub/$', list_detail.object_list, pub_info),
                        (r'^color/$', 'djstu.views.show_color'),
                       
    # Example:
    # (r'^djstu/', include('djstu.foo.urls')),

    # Uncomment the admin/doc line below to enable admin documentation:
    (r'^admin/doc/', include('django.contrib.admindocs.urls')),

    # Uncomment the next line to enable the admin:
    (r'^admin/', include(admin.site.urls)),

)
